package pers.muci.spring.lesson001.demo1;

import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * ClassName: InitTest
 * Description:
 * date: 2022/1/21 10:42
 *
 * @author muci
 * @since JDK 1.8
 */
public class InitTest {
    public static void main(String[] args) {
        // 1.bean 配置文件位置
        String path = "classpath:/lesson001/demo1/bean01.xml";
        //2.创建 ClassPathXmlApplicationContext 容器，指定该容器需要加载的bean配置文件
        ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext(path);
        //3.从容器中获取bean
        HelloWorld helloWorld = applicationContext.getBean("helloWorld", HelloWorld.class);
        //4.使用bean
        helloWorld.say();
    }
}
